"""
# 成员运算符示例
fruits = ["苹果", "香蕉", "橙子"]

print("苹果" in fruits)  # True
print("葡萄" in fruits)  # False
print("香蕉" not in fruits)  # False
print("西瓜" not in fruits)  # True

# 字符串中的成员运算
text = "Hello, World!"
print("Hello" in text)  # True
print("Python" in text)  # False
"""

print(1 and 2)

print("jackie" and "linda")


# 数字示例

print("" and "100")

print(1 and 2)  # 2  - 1为真，返回2
print(0 and 100)  # 0  - 0为假，返回0
print(5 and 0)  # 0  - 5为真，继续判断，返回0

# 列表示例
print([1, 2] and [3, 4])  # [3, 4] - 非空列表为真，返回后面
print([] and [1, 2])  # []     - 空列表为假，返回前面

# 混合类型
print("hello" and 0)  # 0      - 字符串为真，返回0
print(None and "world")  # None   - None为假，返回None

# 多个 and 连接
print("a" and "b" and "c")  # "c"   - 都为真，返回最后一个
print(1 and 0 and 3)  # 0     - 遇到0停止，返回0
print(1 and 2 and "")  # ""    - 遇到空字符串停止


# Python中的假值表
# 0 ,0.0 0j,False, "",[],(),set(),rang()

print("=" * 40)
print(0 and 1)  # 0
print("" and 1)  # ""
print(None and 1)  # None
print(() and 1)  # ()
print([] and 1)  # []
print(0.0 and 1)  # 0.0
print(set() and 1)  # {}
print({} and 1)  # {}
print(range(0) and 1)  #

a = True
b = False
c = True
d = False
e = "e"
# 不推荐：难以理解
value = a and b or c and d or e

print(f"value={value}")
